import { Injectable } from '@angular/core';

import { HttpClient } from "@angular/common/http";

@Injectable({
  providedIn: 'root'
})
export class CommonService {

  constructor(public http: HttpClient) { }

  ajaxGet(api) {
    return new Promise((resolve, reject) => {
      this.http.get(api).subscribe((data) => {
        //console.log(data);
        resolve(data);
      }, (error) => {
        console.log(error);
        reject(error);
      });
    });
  }
}
